<template>
  <div>

    <!-- 展示数据的table -->
    <el-table
      :data="list"
      v-loading.body="listLoading"
      element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">

      <el-table-column max-width="250px" align="center" label="询价单id">
        <template scope="scope">
          <span>{{scope.row.inquiry_id}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="处理标识" max-width="250px">
        <template scope="scope">
          <span>{{scope.row.deal_flag}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="询价单号">
        <template scope="scope">
          <span>{{scope.row.inquiry_no}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="操作" max-width="250px">
        <template scope="scope">
          <el-button type="primary"
                     @click.native=''
                     size="small" icon="edit">XX操作</el-button>
        </template>
      </el-table-column>

    </el-table>

    <div v-show="!listLoading" class="pagination-container" style="margin-top: 30px;">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.curr_page"
                     :page-sizes="[1, 2, 3, 5]" :page-size="listQuery.page_size" layout="total, sizes, prev, pager, next, jumper" :total="total_count">
      </el-pagination>
    </div>

  </div>
</template>

<script>
  import { inquiryList } from '@/api/purchase/inquiry'

  export default {
    name: 'inquiryListDeal',
    data() {
      return {
        list: null,
        listLoading: true,
        total_count:null,//数据总条数
        total_page:null,//总页数
        listQuery: {
          client_type:1,
          curr_page: 1,
          page_size: 2,
        },
      }
    },
    mounted() {
      this.getList()

    },
    methods: {
      getList() {
        this.listLoading = true
        inquiryList(this.listQuery)
          .then(res => {
            this.list = res.inquiry_list
            this.total_count = res.total_count
            this.total_page = res.total_page
            this.listLoading = false
          })
          .catch(err => {
            console.log(err)
            this.$message.error('查询待处理询价单列表失败!')
          })
      },
      handleSizeChange(val) {
        this.listQuery.page_size = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.listQuery.curr_page = val
        this.getList()
      },
    }
  }
</script>

<style lang="scss" scoped>

</style>
